﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using System.Data;

namespace backend_wcf
{
    public class Service : IService
    {
        Database db;

        public Service()
        {
            db = new Database();
        }

        public string GetData(int value)
        {
            return string.Format("You entered: {0}", value);
        }

        public string HelloWorld(){
            return "Hello World!!";
        }

        public DataSet TestDB()
        {
            return db.TestDB();
        }

        public void addData(string tableName, Dictionary<string, Object> values)
        {
            db.addData(tableName, values);
        }

        public void createColumn(string tableName, string columnName, string dbType)
        {
            db.createColumn(tableName, columnName, dbType);
        }

        public void createTable(string name)
        {
            db.createTable(name);
        }

        public DataSet getData(string tableName, string logic_expression)
        {
            return db.getData(tableName, logic_expression);
        }

        public List<string> getStructure(string tableName)
        {
            return db.getStructure(tableName);
        }

        public List<string> getTables()
        {
            return db.getTables();
        }

        public void deleteData(string tableName, int id)
        {
            db.deleteData(tableName,id);
        }
    }
}
